package com.hundsun.yr.universal.p2p.bean;

import java.io.Serializable;
import java.math.BigDecimal;

import com.hundsun.yr.universal.library.utils.HsNumberUtils;
import com.hundsun.yr.universal.library.utils.MathUtils;

/**
 * @Title: UserAccount.java
 * @Description: 账户、资产总览
 * @date 2016-2-2 下午6:24:43
 * @author:hejun.shen
 * @email:shenhj15971@hundsun.com
 * @replace author:
 * @replace date:
 * @version V1.0
 */
public class UserAccount extends ResponseBean implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 * 累计收益
	 */
	private BigDecimal accumulativeIncome;
	/**
	 * 累计投资金额
	 */
	private BigDecimal accumulativeInvest;
	/**
	 * 理财资产
	 */
	private BigDecimal financialAssets;
	/**
	 * 累计借款金额
	 */
	private BigDecimal loanAmount;
	/**
	 * 账户余额（托管账户）
	 */
	private BigDecimal tsAccountBalance;
	/**
	 * 可用余额（托管账户）
	 */
	private BigDecimal tsAvailableBalance;
	/**
	 * 昨日收益
	 */
	private BigDecimal yesterdayIncome;

	public BigDecimal getAccumulativeIncome() {
		return accumulativeIncome;
	}

	public void setAccumulativeIncome(BigDecimal accumulativeIncome) {
		this.accumulativeIncome = accumulativeIncome;
	}

	public BigDecimal getAccumulativeInvest() {
		return accumulativeInvest;
	}

	public void setAccumulativeInvest(BigDecimal accumulativeInvest) {
		this.accumulativeInvest = accumulativeInvest;
	}

	public BigDecimal getFinancialAssets() {
		return financialAssets;
	}

	public void setFinancialAssets(BigDecimal financialAssets) {
		this.financialAssets = financialAssets;
	}

	public BigDecimal getLoanAmount() {
		return loanAmount;
	}

	public void setLoanAmount(BigDecimal loanAmount) {
		this.loanAmount = loanAmount;
	}

	public BigDecimal getTsAccountBalance() {
		return tsAccountBalance;
	}

	public void setTsAccountBalance(BigDecimal tsAccountBalance) {
		this.tsAccountBalance = tsAccountBalance;
	}

	public BigDecimal getTsAvailableBalance() {
		return tsAvailableBalance;
	}

	public void setTsAvailableBalance(BigDecimal tsAvailableBalance) {
		this.tsAvailableBalance = tsAvailableBalance;
	}

	public BigDecimal getYesterdayIncome() {
		return yesterdayIncome;
	}

	public void setYesterdayIncome(BigDecimal yesterdayIncome) {
		this.yesterdayIncome = yesterdayIncome;
	}

	/**
	 * 总资产＝托管账户余额＋理财资产
	 * 
	 * @return
	 */
	public String displayAsset() {

		String totle = MathUtils.plus(tsAccountBalance.toString(), financialAssets.toString());
		return totle;
	}
	
	
	/**
	 * 显示总收益
	 * 
	 * @return
	 */
	public String displayIncome() {

		String income = HsNumberUtils.moneyThousandsFormat(accumulativeIncome.toString());
		return income;
	}
	

	/**
	 * 显示总借款
	 * 
	 * @return
	 */
	public String displayLoan() {

		String loanAmt = HsNumberUtils.moneyTenThousandsFormat(loanAmount.toString());
		return loanAmt;
	}
	
	/**
	 * 显示余额（账户余额）
	 * 
	 * @return
	 */
	public String displayBalance() {

		String balance = HsNumberUtils.moneyThousandsFormat(tsAccountBalance.toString());
		return balance;
	}
	
	/**
	 * 显示可用余额
	 * 
	 * @return
	 */
	public String displayAvailableBalance() {

		String balance = HsNumberUtils.moneyThousandsFormat(tsAvailableBalance.toString());
		return balance;
	}
	
	
	/**
	 * 显示进度 （资产比例）
	 * @return double
	 */
	public float displayProgress(){
		float progress=MathUtils.string2float(MathUtils.division(tsAvailableBalance.toString(), 
				MathUtils.plus(tsAvailableBalance.toString(),financialAssets.toString())));
		
		return progress;
	}

}
